<include file="Public/inc/lite_header.html" />
<body class="hold-transition login-page">
        <div class="login-box">
            <div class="login-box-body">
                <p class="login-box-msg">欢迎使用 BUPT药品仓储管理系统</p>
                <!-- form start -->
                <form class="form-horizontal" method="POST" action="/drm/index.php/Home/User/Index/userAdd.html">
                    <div class="alert alert-danger checkPwd" style='display:none' role="alert"></div>
                    <div class="form-group has-feedback">
                        <input type="text" class="form-control" name='username' placeholder="请输入用户名" required>
                        <span class="glyphicon glyphicon-user form-control-feedback"></span>
                    </div>
                    <div class="form-group has-feedback">
                        <input type="password" class="form-control" name='password' placeholder="请输入密码" required>
                        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
                    </div>
                    <div class="form-group has-feedback">
                        <input type="password" class="form-control" name='rePassword' placeholder="确认密码" required>
                        <span class="glyphicon glyphicon-lock form-control-feedback"></span>
                    </div>
                        <button type="reset" class="btn btn-default">清除</button>
                        <button type="submit" class="btn btn-info pull-right">注册</button>
                </form>
            </div><!-- /.login-box-body -->
        </div><!-- /.login-box -->
        <include file="Public/inc/lite_footer.html" />

<script>
    $("input[name='username']").blur(function(){
        var username = $(this).val();
        $.post('/drm/index.php/Home/User/Index/userCheck.html',{'name':username},function(i){
            if(i == 1){
                $('.checkPwd').html('当前用户已存在哦');
                $('.checkPwd').fadeIn(1000);
                $(this).val('');
            }else{
                $('.checkPwd').fadeOut(1000);
            }
        })
    })

    //验证密码一致性
    $("button[type='submit']").click(function(){
        var pwd = $("input[name='password']").val();
        var rePwd = $("input[name='rePassword']").val();
        if(pwd != rePwd){
            $('.checkPwd').html('两次输入的密码不一致哦');
            $('.checkPwd').fadeIn(1000);
            return false;
        }
    })
</script>
